package adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

/**
 * Created by zhang'lin'lin on 2019/11/11.
 */

public class AboutMePagerAdapter extends FragmentStatePagerAdapter {
    private ArrayList<String> titles;
    private ArrayList <Fragment> fragments;

    public AboutMePagerAdapter(FragmentManager fm, ArrayList <String> titles, ArrayList <Fragment> fragments) {
        super(fm);
        this.titles = titles;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        if (titles!=null){
            return titles.get(position);
        }else{
            return "";
        }

    }
}
